package com.b2b2c.until;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class TimeConvert {

	private String time;
	
	/**
	 * @param startTime
	 */
	public TimeConvert(String time) {
		this.time = time;
	}
	
	/** 
     * 将时间转换为时间戳
     */    
    public String dateToStamp() {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        Date date;
		try {
			date = simpleDateFormat.parse(this.time);
			long ts = date.getTime();
		    return String.valueOf(ts);
		} catch (ParseException e) {
			e.printStackTrace();
		}
		
		return "0";
    }




    /* 
     * 将时间戳转换为时间
     */
    public String stampToDate(){
        String res;
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        long lt = new Long(this.time);
        Date date = new Date(lt);
        res = simpleDateFormat.format(date);
        return res;
    }




	public String getTime() {
		return time;
	}




	public void setTime(String time) {
		this.time = time;
	}
	
}
